<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<script type="text/javascript">

		// ajax calling
		function goConvert(form)	{			
			submitPost(form, numericCallback);
		}
		
		// callback function
		function numericCallback(data){
			//alert(data.euckr2utf8_f+":"+data.euckr2utf8_t);
			$("#euckr2utf8_f").html(data.euckr2utf8_f);
			$("#euckr2utf8_t").html(data.euckr2utf8_t);
			$("#ms2utf8_f").html(data.ms2utf8_f);
			$("#ms2utf8_t").html(data.ms2utf8_t);

			$("#utf82euckr_a").html(data.utf82euckr_a);
			$("#utf82euckr_n").html(data.utf82euckr_n);
			$("#utf82euckr_e").html(data.utf82euckr_e);
			$("#utf82euckr_i").html(data.utf82euckr_i);
			$("#utf82ms_a").html(data.utf82ms_a);
			$("#utf82ms_n").html(data.utf82ms_n);
			$("#utf82ms_e").html(data.utf82ms_e);
			$("#utf82ms_i").html(data.utf82ms_i);
		}
		
		// radio button 제어
		function selectOption(selected){			
			if(selected == "e2u"){
				$('input:radio[name="u2e"]').attr("checked", false); 
				$("#utf82euc").hide();
				$("#euckr2utf8").show();
			}else{
				$('input:radio[name="e2u"]').attr("checked", false);
				$("#euckr2utf8").hide();
				$("#utf82euc").show();
			}
		}


</script>
</head>
<h1>${title}</h1>
<form name="encodingForm" action="./encoding" method="post">
<p class="Margin20"/>

    <table width="60%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" class="HeadCol">변환 종류</td>
        <td class="ListCol"><input type="radio" name="e2u" checked="true" onclick="javascript:selectOption('e2u')"></input>  EUC-KR / MS949 <img src="img/btn_ico_arrow.gif"/> UTF-8</td>
        <td class="ListCol"><input type="radio" name="u2e" onclick="selectOption('u2e')"></input>  UTF-8 <img src="img/btn_ico_arrow.gif"/> EUC-KR / MS949</td>
      </tr>              
      <tr>
        <td class="HeadCol">입력 값</td>
        <td class="ListCol" colspan="2"><textarea id="left_area" name="input" rows="3" cols="100%"></textarea></td>
      </tr>
    </table>    
    <p class="Margin5"/>    
    <table width="60%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center">
        <table border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td class="bt02_L">&nbsp;</td>
              <td class="bt02_bg02"><a href="javascript:goConvert(document.encodingForm);"><img src="img/btn_dn.gif" width="13" height="13" /></a></td>
              <td class="bt02_bg"><a href="javascript:goConvert(document.encodingForm);" class="bt01">변환</a></td>
              <td class="bt02_R">&nbsp;</td>
            </tr>
        </table>
        </td>
      </tr>
    </table>    
    <p class="Margin5"/>    
    <table width="60%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td class="subTitle">변환 결과</td>
            </tr>
        </table></td>
      </tr>
    </table>    
    <p class="Margin5"/>
    
    <table width="60%"  border="0" cellpadding="0" cellspacing="0" id="euckr2utf8">
      <tr>
        <td valign="top" class="box02"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          	<td width="20%" class="HeadCol02" >UTF-8
            <td width="20%" class="HeadCol02" colspan="3">String convertEuckrToUTF8<br>(byte[ ] euckrStream, CharsetType charType, boolean decodeNCR)</td>
          </tr>
          <tr>
            <td width="20%" class="HeadCol02">CharsetType<br/>(입력 문자셋)</td>
            <td width="20%" class="HeadCol02">decodeNCR<br>(NCR 문자>일반 유니코드 문자 변환여부)</td>
            <td class="HeadCol02">변환 결과 값</td>
          </tr>
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02">false</td>
            <td class="ListCol02_L" id="euckr2utf8_f"></td>
          </tr>          
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02">true</td>
            <td class="ListCol02_L" id="euckr2utf8_t"></td>
          </tr>     
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02">false</td>
            <td class="ListCol02_L" id="ms2utf8_f"></td>
          </tr>          
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02">true</td>
            <td class="ListCol02_L" id="ms2utf8_t"></td>
          </tr>              
        </table></td>
      </tr>
    </table>
    <!-- UTF8 >> EUC-KR/MS949 -->
    <table width="60%"  border="0" cellpadding="0" cellspacing="0" id="utf82euc" style="display:none;">
      <tr>
        <td valign="top" class="box02"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
          	<td width="20%" class="HeadCol02" >EUC-KR/MS949
            <td width="20%" class="HeadCol02" colspan="3">byte[ ] convertUTF8ToEuckr<br>
				(String unicodeStr, CharsetType charType, EncodeMethod encodeMethod);</td>
          </tr>
          <tr>
            <td width="20%" class="HeadCol02">CharsetType<br/>(결과 문자셋)</td>
            <td width="20%" class="HeadCol02">EncodeMethod</br>(깨진 글자 인코딩 방식)</td>
            <td class="HeadCol02">변환 결과 값</td>
          </tr>
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02"><b>ALL_NCR</b><br>(모두 NCR)</td>
            <td class="ListCol02_L" id="utf82euckr_a"></td>
          </tr>          
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02"><b>NCR_EUCKR</b><br>(한글은 KS채움쪽자<br/>& 나머지는 NCR)</td>
            <td class="ListCol02_L" id="utf82euckr_n"></td>
          </tr>     
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02"><b>EUCKR</b><br>(한글은 KS채움쪽자<br/>& 나머지는 무시)</td>
            <td class="ListCol02_L" id="utf82euckr_e"></td>
          </tr>    
          <tr>
            <td class="ListCol02">EUC-KR</td>
            <td class="ListCol02"><b>IGNORE</b><br>(모두 무시)</td>
            <td class="ListCol02_L" id="utf82euckr_i"></td>
          </tr>              
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02"><b>ALL_NCR</b><br>(모두 NCR)</td>
            <td class="ListCol02_L" id="utf82ms_a"></td>
          </tr>          
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02"><b>NCR_EUCKR</b><br>(한글은 KS채움쪽자<br/>& 나머지는 NCR)</td>
            <td class="ListCol02_L" id="utf82ms_n"></td>
          </tr>       
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02"><b>EUCKR</b><br>(한글은 KS채움쪽자<br/>& 나머지는 무시)</td>
            <td class="ListCol02_L" id="utf82ms_e"></td>
          </tr>          
          <tr>
            <td class="ListCol02">MS949</td>
            <td class="ListCol02"><b>IGNORE</b><br>(모두 무시)</td>
            <td class="ListCol02_L" id="utf82ms_i"></td>
          </tr>                      
        </table></td>
      </tr>
    </table>
1) 아파트 옆에 있는 헤어 & #20250;
<br>
2) '텿'은 EUC-KR 완성자가 아니다.
<pre>
-쪽자쓰기：KS X 1001 표준에 따라 한글을 채움기호와 초·중·종성으로 풀어쓰는 방식
-NCR：W3C 웹표준에 따라 확장한글을 숫자로 변환하여 표시하는 방식
-MS949：EUC-KR을 기반으로 Microsoft사가 자체 개발한 인코딩 기술
-UTF-8：확장한글을 기본 포함하는 ISO 10646 표준(유니코드) 사용
</pre>

